package com.mayikt.member.service;

import com.alibaba.fastjson.JSONObject;
import com.mayikt.base.BaseResponse;
import com.mayikt.member.input.dto.UserLoginInpDTO;
import com.mayikt.member.output.dto.UserOutDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@Api(tags = "MemberService",description = "会员服务")
public interface MemberService {
    /**
     * 验证手机号是否存在
     * @param mobile
     * @return
     */
    @ApiOperation(value = "校验手机号是否注册")
    @ApiImplicitParams({
        @ApiImplicitParam(paramType = "query", name = "mobile", dataType = "String", required = true, value = "用户手机号码"),
    })
    @PostMapping("/existMobile")
    BaseResponse<UserOutDTO> existMobile(@RequestParam(value = "mobile", required = true)String mobile);

    @ApiOperation(value = "根据token获取用户信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "token", dataType = "String", required = true, value = "token"),
    })
    @PostMapping("/getUserInfo")
    BaseResponse<UserOutDTO> getInfo(@RequestParam(value = "token", required = true)String token);

    /**
     * 用户登陆
     * @param userLoginInpDTO
     * @return
     */
    @ApiOperation("用户登陆接口")
    @PostMapping("/ssologin")
    @Transactional
    public BaseResponse<UserOutDTO> ssoLogin(@RequestBody UserLoginInpDTO userLoginInpDTO);
}
